//
//  YAYIEditTagGroupCollectionCell.m
//  yayi-医生版
//
//  Created by Veer on 16/4/28.
//  Copyright © 2016年 Veer. All rights reserved.
//

#import "YAYIEditTagGroupCollectionCell.h"
#import "YAYIMyPatientItem.h"


@interface YAYIEditTagGroupCollectionCell()



@end

@implementation YAYIEditTagGroupCollectionCell


- (void)setItem:(YAYIMyPatientItem *)item
{
    _item = item;
    
    self.nameLbl.text = item.clientname;
    

    NSString *iconUrlStr = [NSString stringWithFormat:@"%@%@", API, item.avatar];
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:iconUrlStr] placeholderImage:[UIImage imageNamed:@"1"]];

}


- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setupSubView];
    }
    return self;
}

- (void)setupSubView
{
    // icon
    UIImageView *iconView = [[UIImageView alloc] init];
    iconView.layer.masksToBounds = YES;
    iconView.contentMode = UIViewContentModeScaleAspectFill;
    [self.contentView addSubview:iconView];
    self.iconView = iconView;
    
    // 名字
    UILabel *nameLbl = [[UILabel alloc] init];
    nameLbl.font = [UIFont systemFontOfSize:14];
    nameLbl.textColor = YAYIColor(89, 88, 88);
    nameLbl.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:nameLbl];
    self.nameLbl = nameLbl;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(self.contentView);
        make.height.equalTo(self.iconView.mas_width);
        make.top.equalTo(self.contentView);
        make.left.equalTo(self.contentView);
    }];
    self.iconView.layer.cornerRadius = 25;
    
    [self.nameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(self.contentView);
        make.top.equalTo(self.iconView.mas_bottom).offset(5);
        make.left.equalTo(self.contentView);
    }];
}


@end
